import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:life_milestones/MS-global-url.dart';
import 'package:life_milestones/util/MS-config-info-util.dart';
import 'package:url_launcher/url_launcher.dart';

import '../util/MS-log-util.dart';
class MSAboutPage extends StatefulWidget{
  const MSAboutPage({super.key});

  @override
  State<StatefulWidget> createState() {
    return _MSAboutPageState();
  }

}

class _MSAboutPageState extends State<MSAboutPage>{
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SizedBox.expand(child:DecoratedBox(
            decoration: const BoxDecoration(
            image: DecorationImage(
            image: AssetImage("images/mine-common-bg.png")
    )
    ),
    child: Column(
      children: [
        Container(height: ScreenUtil().statusBarHeight + 57.w,width: double.infinity,
        padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight,left: 24.w,right: 24.w),
        child: Stack(
          children: [
            Align(alignment: Alignment.centerLeft,child: InkWell(
              onTap: (){
                Navigator.of(context).pop();
              },
              child: Image.asset("images/back.png",width: 25.w,fit: BoxFit.fitWidth,),),),
            Align(alignment: Alignment.center,child: Text("About",style: TextStyle(fontSize: 20.sp,color: Color(0xFF333333),fontWeight: FontWeight.w500),),)
            
          ],
        ),
        ),
        Padding(padding: EdgeInsets.only(left: 40.w,right: 36.w,top: 16.w),child: Container(
          height: 56.w,
          width: double.infinity,
          decoration: BoxDecoration(
            border: Border(
              bottom: BorderSide(color: Color(0x40333333),width: 1.w)
            )
          ),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text("Version",style: TextStyle(fontSize: 16.sp,color: Color(0xFF333333),fontWeight: FontWeight.w500),),
              Text(MSConfigInfoUtil().version,style: TextStyle(fontSize: 16.sp,color: Color(0xFF333333),fontWeight: FontWeight.w500),)
            ],
          ),
        ),),
        Padding(padding: EdgeInsets.only(left: 40.w,right: 36.w),child: InkWell(
          onTap: ()async{
            MSLog.addEvent(page:MSLogPages.ReadTerms);
            if(await canLaunchUrl(Uri.parse(MSGlobalUrl.userTerm))){
            launchUrl(Uri.parse(MSGlobalUrl.userTerm));
            }
          },
          child: Container(
            height: 56.w,
            width: double.infinity,
            decoration: BoxDecoration(
                border: Border(
                    bottom: BorderSide(color: Color(0x40333333),width: 1.w)
                )
            ),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text("Terms and Conditions",style: TextStyle(fontSize: 16.sp,color: const Color(0xFF333333),fontWeight: FontWeight.w500),),
                Text("",style: TextStyle(fontSize: 16.sp,color: const Color(0xFF333333),fontWeight: FontWeight.w500),)
              ],
            ),
          ),
        ),),
        Padding(padding: EdgeInsets.only(left: 40.w,right: 36.w),child: InkWell(
          onTap: ()async{
            MSLog.addEvent(page:MSLogPages.ReadPrivacy);
              if(await canLaunchUrl(Uri.parse(MSGlobalUrl.privacy))){
                launchUrl(Uri.parse(MSGlobalUrl.privacy));
              }
          },
          child: SizedBox(
            height: 56.w,
            width: double.infinity,
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text("Privacy Policy",style: TextStyle(fontSize: 16.sp,color: const Color(0xFF333333),fontWeight: FontWeight.w500),),
                Text("",style: TextStyle(fontSize: 16.sp,color: const Color(0xFF333333),fontWeight: FontWeight.w500),)
              ],
            ),
          ),
        ),)
      ],
    ))));
  }

}